﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace EasierRdp.Util
{
    static class XElementExtension
    {
        public static string GetString(this XElement element, string attributeName)
        {
            return (string) element.Attribute(attributeName);
        }

        public static bool GetBoolean(this XElement element, string attributeName)
        {
            var value = element.Attribute(attributeName);
            return value != null && (bool) value;
        }

        public static int GetInt(this XElement element, string attributeName)
        {
            return (int)element.Attribute(attributeName);
        }

        public static int? GetNullableInt(this XElement element, string attributeName)
        {
            return (int?)element.Attribute(attributeName);
        }
    }
}
